www.gusucode.com > VC++ 树节点动态添加插入-源码程序 > VC++ 树节点动态添加插入-源码程序/code/Zip.cpp
//Download by http://www.NewXing.com // Zip.cpp: implementation of the CZip class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "Note.h" #include "Zip.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CZip::CZip(CString strInputFile) { m_strFileName=strInputFile; ASSERT(!m_strFileName.IsEmpty()); } CZip::~CZip() { } void CZip::SwapSize(CString strOutputFile) { ASSERT(!strOutputFile.IsEmpty()); ASSERT(strOutputFile.CompareNoCase(m_strFileName)); CZipFile zf(strOutputFile, 0); char buf[BUF_SIZE]; CFile file(m_strFileName, CFile::modeRead); zip_fileinfo zi; zf.UpdateZipInfo(zi, file); zf.OpenNewFileInZip(m_strFileName, zi, Z_BEST_COMPRESSION); int size_read; do { size_read = file.Read(buf, BUF_SIZE); if (size_read) zf.WriteInFileInZip(buf, size_read); } while (size_read == BUF_SIZE); zf.Close(); }